package org.hawk.gwt.ppc.parser;

/**
 * {@link Descriptor} that may contain other descriptors.
 * 
 * @author alex.bereznevatiy@gmail.com
 */
public interface DescriptorContainer extends Descriptor, Iterable<Descriptor> {
	
	/**
	 * @param index
	 * @return descriptor with index specified.
	 * @throws DescriptorIndexOutOfBoundException in case if index does not exists
	 */
	Descriptor get(int index) throws DescriptorIndexOutOfBoundException;
	
	/**
	 * Removes descriptor at index specified.
	 * @param index
	 * @return removed descriptor.
	 * @throws DescriptorIndexOutOfBoundException in case if index does not exists
	 */
	Descriptor remove(int index) throws DescriptorIndexOutOfBoundException;
	
	/**
	 * @return amount of child descriptors in this container.
	 */
	int size();
}
